<include file="__THEME__/admin_header" />
<script type="text/javascript" src="__APP__/Js/json2select.js"></script>
<script type="text/javascript">
function checkAll(o){
    if( o.checked == true ){
        $('input[name="checkbox"]').attr('checked','true');
        $('tr[overstyle="on"]').addClass("bg_on");
    }else{
        $('input[name="checkbox"]').removeAttr('checked');
        $('tr[overstyle="on"]').removeClass("bg_on");
    }
}

function checkon(o){
    if( o.checked == true ){
        $(o).parents('tr').addClass('bg_on') ;
    }else{
        $(o).parents('tr').removeClass('bg_on') ;
    }
}

function getChecked() {
    var ids = new Array();
    var id;
    $.each($('table input:checked'), function(i, n){
    	id = $(n).val();
        if (id > 0) ids.push(id);
    });
    return ids;
}

// 搜索
var isSearchHidden = <neq name="isSearch" value="1">1<else/>0</neq>;
function searchObject() {
  if(isSearchHidden == 1) {
      $("#searchObject_div").slideDown("fast");
      $(".searchObject_action").html("搜索完毕");
      isSearchHidden = 0;
  }else {
      $("#searchObject_div").slideUp("fast");
      $(".searchObject_action").html("搜索微博");
      isSearchHidden = 1;
  }
}

var ctrl = function(){
}
ctrl.prototype = {
	del:function(id, gid, uid, type){
		var id = id ? id : getChecked();
		id = id.toString();
		if(id=='' || id==0) return;
	    if (confirm("确认删除微博？")) {
	        $.post( '__URL__&act=remove',{id:id,gid:gid,uid:uid,type:type},function(text){
	        	if (text == 1) {
	                ui.success("删除多条微博成功");
	                var id_list = id.split( ',' );   
	                for (var j=0 ; j< id_list.length ; j++) {
	                	$('#list_' + id_list[j]).remove(); 
	                }
	            } else if ( text == 2 ){
	                ui.success( "删除成功" );
	                $('#list_' + id).remove();
	            } else {
	            	ui.error("删除失败");
	            }
	        });
	    }
	}
}
var c = null;
</script>
<div class="so_main"><include file="_tab" /> <include
	file="_manage_tab" />

<div id="searchObject_div"<neq name="isSearch" value="1">style="display:none;"</neq>>
<div class="page_tit">搜索微博 [ <a
	href="javascript:void(0);" onclick="searchObject();">隐藏</a> ]</div>
<div class="form2">
<form method="post"><input
	type="hidden" name="isSearch" value="1" /> <php>if($isSearch !=
'1') $uid = '';</php>
	<dl class="lineD">
		<dt>微博ID：</dt>
		<dd><input type="text" name="feed_id" class="txt" value="{$feed_id}">
		</dd>
	</dl>
	<dl class="lineD">
		<dt>群组ID：</dt>
		<dd><input type="text" name="gid" class="txt" value="{$gid}" /></dd>
	</dl>
	<dl class="lineD">
		<dt>用户ID：</dt>
		<dd><input type="text" name="uid" class="txt" value="{$uid}" /></dd>
	</dl>
	<dl class="lineD">
		<dt>内容：</dt>
		<dd><input type="text" name="content" class="txt" value="{$content}" /><span>支持模糊查询。</span>
		</dd>
	</dl>
	<dl>
	<dt>结果排序：</dt>
		<dd><select name="field">
			<option value="ctime"<eq name="field" value="ctime">selected</eq>
			>时间排序</option>
          	<option value="transpond" <eq name="field" value="transpond">selected</eq>
          	>转发数</option>
          	<option value="comment" <eq name="field" value="comment">selected</eq>
          	>评论数</option>
		</select> <select name="order">
			<option value="desc"<eq name="order" value="desc">selected</eq>
			>降序</option>
			<option value="asc"<eq name="order" value="asc">selected</eq>
			>升序</option>
		</select> <select name="limit">
			<option value="10"<eq name="limit" value="10">selected</eq>
			>每页显示10条</option>
			<option value="20"<eq name="limit" value="20">selected</eq>
			>每页显示20条</option>
			<option value="30"<eq name="limit" value="30">selected</eq>
			>每页显示30条</option>
			<option value="100"<eq name="limit" value="100">selected</eq>
			>每页显示100条</option>
		</select>
		</dd>
	</dl>
	<div class="page_btm"><input type="submit" class="btn_b"
	value="确定" /></div>
</form>
</div>
</div>

<div class="Toolbar_inbox">
<div class="page right">{$list['html']}</div>
<a href="javascript:void(0);" class="btn_a" onclick="searchObject();">
<span class="searchObject_action"><neq name="isSearch" value="1">搜索微博<else />搜索完毕</neq></span>
</a> <!--
        <a href="javascript:void(0);" class="btn_a" onclick="c.transfer()"><span>推荐微博</span></a>
        <a href="javascript:void(0);" class="btn_a" onclick="c.transfer()"><span>取消推荐</span></a>
         <a href="javascript:void(0);" class="btn_a"
	onclick="c.del()"><span>删除微博</span></a>-->
</div>

<div class="list">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<!-- <th style="width: 30px;"><input type="checkbox"
			id="checkbox_handle" onclick="checkAll(this)" value="0"> <label
			for="checkbox"></label></th> -->
		<th class="line_l">ID</th>
        <th class="line_l">内容</th>
		<th class="line_l">群组</th>
		<th class="line_l">用户名</th>
        <th class="line_l">转发数/评论数</th>
        <th class="line_l">发布时间</th>
        <th class="line_l">类型</th>
        <th class="line_l">来自</th>
        <th class="line_l">操作</th>
	</tr>
	<volist name="list['data']" id='vo'>
	<tr id="list_{$vo.feed_id}">
		<!-- <td><input type="checkbox" name="checkbox" id="checkbox2" onclick="checkon(this)" value="{$vo.feed_id}"></td> -->
		<td>{$vo.feed_id}</td>
		<td><a href="{:U('group/Group/detail', array('gid'=>$vo['gid'],'id'=>$vo['feed_id']))}" target="_blank">{$vo.body|getShort=36}</a></td>
		<td><a href="{:U('group/Group/index', array('gid'=>$vo['gid']))}" target="_blank">{$_group_names[$vo['gid']]}</a></td>
		<td><space uid="vo.uid" target="_blank">{uname}</space></td>
		<td>{$vo.repost_count} / {$vo.comment_count}</td>
		<td>{$vo.ctime|friendlyDate}</td>
		<td>
			<switch name="vo.type">
		    	<case value="0">
		        	纯文字
		        </case>
		        <case value="1">
		        	图片
		        </case>
		        <case value="3">
		        	视频
		        </case>
		        <case value="4">
		        	音乐 
		        </case>
			</switch>
		</td>
		<td><?php echo getFrom($vo['from'], $vo['from_data']);?></td>
		<td><a href="javascript:void(0)" onclick="c.del({$vo.feed_id}, {$vo.gid}, {$vo.uid}, 'feed')">删除</a></td>
	</tr>
	</volist>
</table>
</div>

<div class="Toolbar_inbox">
<div class="page right">{$list['html']}</div>
<a href="javascript:void(0);" class="btn_a" onclick="searchObject();">
<span class="searchObject_action"><neq name="isSearch" value="1">搜索微博<else />搜索完毕</neq></span>
</a> <!--
        <a href="javascript:void(0);" class="btn_a" onclick="c.transfer()"><span>推荐微博</span></a>
        <a href="javascript:void(0);" class="btn_a" onclick="c.transfer()"><span>取消推荐</span></a>
        <a href="javascript:void(0);" class="btn_a"
	onclick="c.del()"><span>删除微博</span></a> -->
</div>
</div>
<include file="_footer" />
<script type="text/javascript">
c = new ctrl();
</script>